﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class CommentMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.Comment>
    {
        public CommentMap()
        {
            // table
            //ToTable("CMS_Comments");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.ReplyId)
                
                .IsOptional();
            Property(t => t.ModelId)
                
                .IsRequired();
            Property(t => t.ContentId)
                
                .IsRequired();
            Property(t => t.UserName)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Score)
                
                .HasPrecision(18, 1)
                .IsRequired();
            Property(t => t.Content)
                
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.Pass)
                
                .IsRequired();
            Property(t => t.IP)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.Support)
                
                .IsRequired();
            Property(t => t.Oppose)
                
                .IsRequired();
            Property(t => t.CreateTime)
                
                .IsRequired();
            Property(t => t.UpdateTime)
                
                .IsRequired();
            Property(t => t.Floor)
                
                .IsOptional();
            Property(t => t.MaxFloor)
                
                .IsOptional();
            Property(t => t.Path)
                .IsUnicode(false)
                .HasMaxLength(1000)
                .IsOptional();

            // Relationships
            HasRequired(t => t.ContentCore)
                .WithMany(t => t.ContentComments)
                .HasForeignKey(d => d.ContentId);
           
            //InitializeMapping();
        }
    }
}

